package wechat.user;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.common.BaseModel;
import com.common.CommonUtil;
import com.common.Dateutil;
import com.common.ResultData;
import com.filter.BaseController;

import beans.subject.subchapterBean;
import beans.sys.UserBean;
import beans.user.UserSearch;
import beans.user.WithdrawcashSearch;
import beans.user.user;
import beans.user.withdrawcash;
import service.user.WXUserServiceImpl;
import service.user.WithdrawcashServiceImpl;
@Controller
@RequestMapping("/wx")
public class WXUserCenterController extends BaseController{

	@Resource
	private WXUserServiceImpl<user> wxUserServiceImpl;
	@Resource
	private WithdrawcashServiceImpl<withdrawcash> withdrawcashServiceImpl;
	/**
	 * 分享信息
	 * @return
	 */
	@RequestMapping("/shareuser")
	public String shareuser() {
		return "wechat/usercenter/shareuser";
	}

	/**
	 * 分享列表
	 * @param model
	 */
	@RequestMapping("/shareuserdata")
	@ResponseBody
	public void shareuserdata(UserSearch model) {
		List<user> rd = new ArrayList<>();
		try{
			user u = (user)getReq().getSession().getAttribute("wxuser");
			model.setQr_scene_str(u.getOpenid());
			rd = wxUserServiceImpl.queryByList(model);
		}
		catch(Exception e){
			e.printStackTrace();
		}
		responseJsonArray(rd);
	}
	
	/**
	 * 提现记录
	 * @return
	 */
	@RequestMapping("/applylist")
	public String applylist() {
		return "wechat/usercenter/applylist";
	}
	
	@RequestMapping("/applylistdata")
	@ResponseBody
	public void applylistdata(WithdrawcashSearch model) {
		List<withdrawcash> rd = new ArrayList<>();
		try{
			user u = (user)getReq().getSession().getAttribute("wxuser");
			model.setUid(u.getOpenid());
			rd = withdrawcashServiceImpl.queryByList(model);
		}
		catch(Exception e){
			e.printStackTrace();
		}
		responseJsonArray(rd);
	}
}
